With PDF for UWP class library you can create PDF documents in code and save them out to a stream. The following code snippet shows how to create a simple document and load it into C1PdfViewer without having to save it into isolated storage or put it on the Web:
Visual Basic |
Copy Code
|
---|---|
' create new C1PdfDocument Dim doc As New C1PdfDocument() ' add some content to PDF doc.DrawString("Hello World!", New Font("Arial", 14), Colors.Black, doc.PageRectangle) ' save PDF to memory stream Dim ms As New MemoryStream() doc.Save(ms) ' load PDF from stream ms.Seek(0, SeekOrigin.Begin) c1PdfViewer1.LoadDocument(ms) |
C# |
Copy Code
|
---|---|
// create new C1PdfDocument C1PdfDocument doc = new C1PdfDocument(); // add some content to PDF doc.DrawString("Hello World!", new Font("Arial", 14), Colors.Black, doc.PageRectangle); // save PDF to memory stream MemoryStream ms = new MemoryStream(); doc.Save(ms); // load PDF from stream ms.Seek(0, SeekOrigin.Begin); await c1PdfViewer1.LoadDocumentAsync(ms); |